
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>版本 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="flow.html" />
    
    
    <link rel="prev" href="branch.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    首页
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="about.html">
            
                <a href="about.html">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="repository.html">
            
                <a href="repository.html">
            
                    
                    仓库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="branch.html">
            
                <a href="branch.html">
            
                    
                    分支
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5" data-path="version.html">
            
                <a href="version.html">
            
                    
                    版本
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="flow.html">
            
                <a href="flow.html">
            
                    
                    流程
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >版本</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x7248;&#x672C;-version">&#x7248;&#x672C; Version</h1>
<blockquote>
<p>&#x4E25;&#x683C;&#x6765;&#x8BB2;&#xFF0C;Git&#x5E76;&#x4E0D;&#x5B58;&#x5728;&#x7248;&#x672C;&#x7684;&#x6982;&#x5FF5;&#xFF0C;&#x4F46;&#x4EBA;&#x4EEC;&#x4E5F;&#x786C;&#x662F;&#x53D1;&#x5C55;&#x51FA;&#x4E86;&#x8FD9;&#x4E48;&#x4E2A;&#x73A9;&#x610F;&#xFF0C;&#x5728;Git&#x4E2D;&#xFF0C;&#x8BA1;&#x6570;&#x57FA;&#x7840;&#x662F;&#x63D0;&#x4EA4;&#xFF0C;&#x5373;&#x6211;&#x4EEC;&#x5E38;&#x8BF4;&#x7684;Commit&#xFF0C;&#x6211;&#x4EEC;&#x6BCF;&#x505A;&#x4E00;&#x70B9;&#x66F4;&#x6539;&#x4FBF;&#x53EF;&#x4EE5;&#x4EA7;&#x751F;&#x4E00;&#x6B21;&#x63D0;&#x4EA4;&#xFF0C;&#x5F53;&#x63D0;&#x4EA4;&#x7D2F;&#x8BA1;&#x8D77;&#x6765;&#xFF0C;&#x53EF;&#x4EE5;&#x4F5C;&#x4E3A;&#x4EA7;&#x54C1;&#x5B9A;&#x578B;&#x65F6;&#xFF0C;&#x5C31;&#x5728;&#x5F53;&#x524D;&#x7684;Commit&#x4E0A;&#x6253;&#x4E0A;&#x4E00;&#x4E2A;&#x6807;&#x8BB0;&#xFF0C;&#x5C06;&#x8FD9;&#x4E2A;&#x6807;&#x8BB0;&#x6211;&#x4EEC;&#x79F0;&#x4E4B;&#x4E3A;&#x7248;&#x672C;&#x591A;&#x5C11;&#x591A;&#x5C11;&#xFF0C;&#x90A3;&#x4E48;&#x5C31;&#x7B97;&#x5B8C;&#x6210;&#x4E86;&#x4E00;&#x4E2A;&#x7248;&#x672C;&#xFF0C;&#x6807;&#x8BB0;&#x672C;&#x8EAB;&#x88AB;&#x79F0;&#x4E4B;&#x4E3A;Tag&#xFF0C;&#x8BF7;&#x6CE8;&#x610F;&#xFF0C;&#x5728;Git&#x4E2D;&#xFF0C;&#x7248;&#x672C;&#x4EC5;&#x4EC5;&#x53EA;&#x662F;&#x67D0;&#x4E00;&#x4E2A;&#x63D0;&#x4EA4;&#x7684;&#x6807;&#x7B7E;&#xFF0C;&#x5E76;&#x6CA1;&#x6709;&#x5176;&#x4ED6;&#x610F;&#x4E49;&#xFF0C;Git&#x672C;&#x8EAB;&#x4E5F;&#x4EC5;&#x6709;&#x6253;&#x6807;&#x7B7E;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x5E76;&#x6CA1;&#x6709;&#x7248;&#x672C;&#x529F;&#x80FD;&#xFF0C;&#x7248;&#x672C;&#x529F;&#x80FD;&#x662F;&#x6839;&#x636E;Tag&#x6765;&#x6269;&#x5C55;&#x7684;&#xFF0C;Git&#x672C;&#x8EAB;&#x5E76;&#x6CA1;&#x6709;</p>
</blockquote>
<h2 id="&#x64A4;&#x9500;">&#x64A4;&#x9500;</h2>
<ul>
<li>&#x67E5;&#x770B;&#x5DE5;&#x4F5C;&#x533A;&#x4E0E;&#x6682;&#x5B58;&#x533A;&#x7684;&#x5DEE;&#x5F02;<pre><code class="lang-bash">$ git diff
</code></pre>
</li>
<li>&#x67E5;&#x770B;&#x6682;&#x5B58;&#x533A;&#x4E0E;&#x7248;&#x672C;&#x5E93;&#x7684;&#x5DEE;&#x5F02;<pre><code class="lang-bash">$ git diff --cached
</code></pre>
</li>
<li>&#x64A4;&#x9500;&#x5DE5;&#x4F5C;&#x533A;&#x7684;&#x4FEE;&#x6539;<pre><code class="lang-bash">$ git checkout .
</code></pre>
</li>
<li>&#x64A4;&#x9500;&#x6682;&#x5B58;&#x533A;&#x7684;&#x4FEE;&#x6539;<pre><code class="lang-bash">$ git reset HEAD
$ git reset HEAD dir/file(s)
</code></pre>
</li>
</ul>
<h2 id="&#x56DE;&#x9000;">&#x56DE;&#x9000;</h2>
<ul>
<li>&#x67E5;&#x770B;&#x7248;&#x672C;&#x8BB0;&#x5F55;<pre><code class="lang-bash">$ git <span class="hljs-built_in">log</span>
</code></pre>
</li>
<li>&#x56DE;&#x9000;&#x81F3;&#x4E0A;&#x51E0;&#x4E2A;&#x7248;&#x672C;<pre><code class="lang-bash">$ git reset --hard HEAD~1
$ git reset --hard HEAD~2
</code></pre>
</li>
<li>&#x56DE;&#x9000;&#x81F3;&#x5177;&#x4F53;&#x67D0;&#x4E2A;&#x7248;&#x672C;<pre><code class="lang-bash">$ git reset --hard 6fcfc89
</code></pre>
</li>
</ul>
<h2 id="&#x6682;&#x5B58;">&#x6682;&#x5B58;</h2>
<ul>
<li>&#x5148;&#x628A;&#x9700;&#x8981;&#x6682;&#x5B58;&#x7684;&#x6587;&#x4EF6;&#x64CD;&#x4F5C;&#x8BB0;&#x5F55;&#x6DFB;&#x52A0;&#x5230;&#x6682;&#x5B58;&#x533A;<pre><code class="lang-bash">$ git add .
$ git add foo.js
</code></pre>
</li>
<li>&#x67E5;&#x770B;&#x5F53;&#x524D;&#x6682;&#x5B58;&#x533A;&#x7684;&#x60C5;&#x51B5;<pre><code class="lang-bash">$ git status
</code></pre>
</li>
<li>&#x6682;&#x5B58;<pre><code class="lang-bash">$ git stash
$ git stash save <span class="hljs-string">&apos;some thing&apos;</span>
</code></pre>
</li>
<li>&#x67E5;&#x770B;&#x6709;&#x591A;&#x5C11;&#x6682;&#x5B58;&#x8BB0;&#x5F55;<pre><code class="lang-bash">$ git stash list
</code></pre>
</li>
<li>&#x6E05;&#x7A7A;&#x6682;&#x5B58;&#x8BB0;&#x5F55;<pre><code class="lang-bash">$ git stash clear
</code></pre>
</li>
<li>&#x6062;&#x590D;&#x6682;&#x5B58;&#x7684;&#x6539;&#x52A8;<pre><code class="lang-bash">$ git stash apply
$ git stash apply &lt;index&gt;
</code></pre>
</li>
<li>&#x5220;&#x9664;&#x6682;&#x5B58;&#x8BB0;&#x5F55;<pre><code class="lang-bash">$ git stash drop
$ git stash drop &lt;index&gt;
</code></pre>
</li>
<li>&#x6062;&#x590D;&#x6682;&#x5B58;&#x7684;&#x6539;&#x52A8;&#xFF0C;&#x5E76;&#x4E14;&#x5220;&#x9664;&#x8BB0;&#x5F55;<pre><code class="lang-bash">$ git stash pop
$ git stash pop &lt;index&gt;
</code></pre>
</li>
</ul>
<h2 id="&#x6807;&#x7B7E;">&#x6807;&#x7B7E;</h2>
<ul>
<li>&#x521B;&#x5EFA;&#x6807;&#x7B7E;<pre><code class="lang-bash">$ git tag v1.0
$ git tag v1.0 -m <span class="hljs-string">&apos;&#x7B2C;&#x4E00;&#x7248;&apos;</span>
</code></pre>
</li>
<li>&#x67E5;&#x770B;&#x521B;&#x5EFA;&#x5217;&#x8868;<pre><code class="lang-bash">$ git tag
$ git tag -n
</code></pre>
</li>
<li>&#x5207;&#x6362;&#x5230;&#x5BF9;&#x5E94;&#x6807;&#x7B7E;&#x7684;&#x7248;&#x672C;<pre><code class="lang-bash">$ git checkout v1.0
$ git checkout master
</code></pre>
</li>
<li>&#x5220;&#x9664;&#x6807;&#x7B7E;<pre><code class="lang-bash">$ git tag <span class="hljs-_">-d</span> v1.0
</code></pre>
</li>
<li>&#x8865;&#x6253;&#x6807;&#x7B7E;<pre><code class="lang-bash">$ git tag v1.0 9fbc3d0
</code></pre>
</li>
<li>&#x6807;&#x7B7E;&#x53D1;&#x5E03;&#x5230;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;<pre><code class="lang-bash">$ git push origin v1.0
$ git push origin &#x2013;tags
</code></pre>
</li>
<li>&#x5220;&#x9664;&#x8FDC;&#x7A0B;&#x4ED3;&#x5E93;&#x7684;&#x6807;&#x7B7E;<pre><code class="lang-bash">$ git push origin :refs/tags/v1.0
</code></pre>
</li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="branch.html" class="navigation navigation-prev " aria-label="Previous page: 分支">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="flow.html" class="navigation navigation-next " aria-label="Next page: 流程">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"版本","level":"1.5","depth":1,"next":{"title":"流程","level":"1.6","depth":1,"path":"flow.md","ref":"flow.md","articles":[]},"previous":{"title":"分支","level":"1.4","depth":1,"path":"branch.md","ref":"branch.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"version.md","mtime":"2017-11-29T01:48:18.564Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2017-11-29T01:49:36.040Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

